package entity;
import java.security.*;
/**
 *
 * 
 */
public class Users {

    private String idUser;
    private String nama;
    private String alamat;
    private String telepon;
    private String email;
    private String email_user;
    private String password;
    private int adminStat;

    /**
     * @param id_user the id_user to set
     */
    public void setIdUser(String idUser) {
        this.idUser = idUser;
    }

    /**
     * @return the id_user
     */
    public String getIdUser() {
        return idUser;
    }

    /**
     * @param nama the nama to set
     */
    public void setNama(String nama) {
        this.nama = nama;
    }

    /**
     * @return the nama
     */
    public String getNama() {
        return nama;
    }

    /**
     * @param alamat the alamat to set
     */
    public void setAlamat(String alamat) {
        this.alamat = alamat;
    }

    /**
     * @return the alamat
     */
    public String getAlamat() {
        return alamat;
    }

    /**
     * @param telepon the telepon to set
     */
    public void setTelepon(String telepon) {
        this.telepon = telepon;
    }

    /**
     * @return the telepon
     */
    public String getTelepon() {
        return telepon;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email_user the email_user to set
     */
    public void setemail_user(String email_user) {
        this.email_user = email_user;
    }

    /**
     * @return the email_user
     */
    public String getemail_user() {
        return email_user;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    
    
    //admin status
    public void setAdminStat(int adminStat) {
        this.adminStat = adminStat;
    }

    /**
     * @return the password
     */
    public int getAdminStat() {
        return adminStat;
    }
    
    //encript
    public String MD5(String text) throws NoSuchAlgorithmException {
        MessageDigest mdAlgorithm = MessageDigest.getInstance("md5");
        mdAlgorithm.update(text.getBytes());
        byte[] digest = mdAlgorithm.digest();
        StringBuilder hexString = new StringBuilder();
        for (int i = 0; i < digest.length; i++) {

            text = Integer.toHexString(0xFF & digest[i]);
            if (text.length() < 2) {
                text= "0" + text;
            }
            hexString.append(text);
        }
        String md5 = hexString.toString();
        return md5;    
    }
}
